package rui.game.move;

import lombok.Getter;
import lombok.Setter;

/**
 * 移动策略
 */
@Getter
@Setter
public class MoveStrategy {

    private Move.Left left = new Move.Left(null);
    private Move.Right right = new Move.Right(null);
    private Move.Up up = new Move.Up(null);
    private Move.Down down = new Move.Down(null);


    /**
     * 策略
     *
     * @param ch 键盘方向
     * @return 移动具体类
     */
    public Move strategy(char ch) {
        switch (ch) {
            case 97:
                return left;
            case 100:
                return right;
            case 119:
                return up;
            case 115:
                return down;
            default:
                throw new UnsupportedOperationException("键盘参数不支持,输入为 " + ch);
        }
    }

}
